package modules.user.entity;

import java.util.Date;

import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.Table;
import javax.persistence.Temporal;
import javax.persistence.TemporalType;

import org.hibernate.annotations.Cache;
import org.hibernate.annotations.CacheConcurrencyStrategy;

/**
 * 验证码
 * @author langhsu on 2015/8/14.
 */

@Entity
@Table(name="mto_verify")
@Cache(usage=CacheConcurrencyStrategy.NONSTRICT_READ_WRITE)
public class Verify {

	@Id
	@GeneratedValue(strategy=GenerationType.IDENTITY)
	private long id;
	
	@Column(name="user_id",unique=true)
	private long userId;// 用户ID
	
	@Column(length=60,nullable=false)
	private String code;// 验证码
	
	@Column(length=96)
	private String target; // 目标：邮箱
	
	@Column
	private int type; // 验证类型：注册验证、找回密码验证
	
	@Column(name="expired",nullable=false)
	@Temporal(TemporalType.TIMESTAMP)
	private Date expired;// 过期时间
	
	public long getId() {
		return id;
	}

	public void setId(long id) {
		this.id = id;
	}

	public long getUserId() {
		return userId;
	}

	public void setUserId(long userId) {
		this.userId = userId;
	}

	public String getCode() {
		return code;
	}

	public void setCode(String code) {
		this.code = code;
	}

	public String getTarget() {
		return target;
	}

	public void setTarget(String target) {
		this.target = target;
	}

	public int getType() {
		return type;
	}

	public void setType(int type) {
		this.type = type;
	}

	public Date getExpired() {
		return expired;
	}

	public void setExpired(Date expired) {
		this.expired = expired;
	}

	public Date getCreated() {
		return created;
	}

	public void setCreated(Date created) {
		this.created = created;
	}

	public String getToken() {
		return token;
	}

	public void setToken(String token) {
		this.token = token;
	}

	public int getStatus() {
		return status;
	}

	public void setStatus(int status) {
		this.status = status;
	}

	@Column(name="created",nullable=false)
	@Temporal(TemporalType.TIMESTAMP)
	private Date created;// 创建时间
	
	private String token;
	
	@Column
    private int status; // 状态：正常、关闭
	
}
